﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true"
    CodeBehind="ServiceReportView.aspx.cs" Inherits="SEP.Admin.ServiceReportView" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server">
    <script src="../Scripts/jquery-ui.min.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $("#lnkShowDetails").click(function (e) {

            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphTitle" runat="server">
    Service Reports
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphBody" runat="server">
    <asp:Label ID="lblJobInfo" runat="server" Font-Bold="true" Font-Size="Medium" />
    <br />
    <br />
    <asp:Button ID="btnCreateServiceReport" runat="server" Text="Create Service Report"
        OnClick="btnCreateServiceReport_Click" />
    <br />
    <div id="details">
        <table align="center">
            <tr>
                <td>
                    <table rules="all" border="1" cellpadding="10" cellspacing="10">
                        <tr>
                            <td align="right">
                                Facility
                            </td>
                            <td align="left">
                                <asp:Label ID="lblLocationFacility" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" align="right">
                                Street
                            </td>
                            <td align="left">
                                <asp:Label ID="lblLocationStreet" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                City, State, Zip
                            </td>
                            <td align="left">
                                <asp:Label ID="lblLocationCityStateZip" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Contact
                            </td>
                            <td align="left">
                                <asp:Label ID="lblLocationContact" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Phone
                            </td>
                            <td align="left">
                                <asp:Label ID="lblLocationPhone" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Fax
                            </td>
                            <td align="left">
                                <asp:Label ID="lblLocationFax" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Email
                            </td>
                            <td align="left">
                                <asp:Label ID="lblLocationEmail" runat="server" />
                            </td>
                        </tr>
                    </table>
                </td>
                <td>
                    <table rules="all" border="1" cellpadding="10" cellspacing="10">
                        <tr>
                            <td align="right">
                                Facility
                            </td>
                            <td align="left">
                                <asp:Label ID="lblBillToFacility" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" align="right">
                                Street
                            </td>
                            <td align="left">
                                <asp:Label ID="lblBillToStreet" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                City, State, Zip
                            </td>
                            <td align="left">
                                <asp:Label ID="lblBillToCityStateZip" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Contact
                            </td>
                            <td align="left">
                                <asp:Label ID="lblBillToContact" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Phone
                            </td>
                            <td align="left">
                                <asp:Label ID="lblBillToPhone" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Fax
                            </td>
                            <td align="left">
                                <asp:Label ID="lblBillToFax" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right">
                                Email
                            </td>
                            <td align="left">
                                <asp:Label ID="lblBillToEmail" runat="server" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <br />
    <a href="#" id="lnkShowDetails">Show details</a>
    <br />
    <asp:GridView ID="grvServiceReports" runat="server" AutoGenerateColumns="false" EmptyDataText="No service reports have been created for this job."
        DataKeyNames="ID" OnRowDataBound="grvServiceReports_OnRowDataBound" OnRowDeleting="grvServiceReports_DeleteRecord">
        <Columns>
            <asp:TemplateField HeaderText="Export to">
                <ItemTemplate>
                    <asp:LinkButton ID="lnkBtnExportExcel" runat="server" OnCommand="lnkBtnExportExcel_OnCommand"
                        Text="Excel" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Machine">
                <ItemTemplate>
                    <asp:HyperLink ID="hyperlinkEdit" runat="server" NavigateUrl='<%# string.Format("{0}{1}{2}", DataBinder.Eval(Container.DataItem, "ID", "~/Admin/ServiceReport.aspx?id={0}"), DataBinder.Eval(Container.DataItem, "JOBID", "&jobid={0}"), DataBinder.Eval(Container.DataItem, "ARCHIVED", "&archived={0}")) %>'
                        Text='<%# DataBinder.Eval(Container.DataItem, "INSTRUMENT.MODEL") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Serial number">
                <ItemTemplate>
                    <%# DataBinder.Eval(Container.DataItem, "INSTRUMENT.SERIALNUMBER") %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="PONUMBER" HeaderText="PO Number" Visible="false" />
            <asp:BoundField DataField="SERVICEREQUIRED" HeaderText="Service required" Visible="true" />
            <asp:BoundField DataField="SERVICEPERFORMED" HeaderText="Service performed" Visible="false" />
            <asp:BoundField DataField="ADDEDBY" HeaderText="Created by" Visible="false" />
            <asp:BoundField DataField="CHANGEDBY" HeaderText="Last modified by" />
            <asp:TemplateField HeaderText="Sent to Ian">
                <ItemTemplate>
                    <asp:Image ID="imgSentToIan" runat="server" ImageUrl="~/Images/check_20x15.png" Visible='<%#DataBinder.Eval(Container.DataItem, "SentToIan") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Sent to Jenny">
                <ItemTemplate>
                    <asp:Image ID="imgSentToJenny" runat="server" ImageUrl="~/Images/check_20x15.png"
                        Visible='<%#DataBinder.Eval(Container.DataItem, "SentToJenny") %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("ID") %>'
                        CommandName="Delete" Text="Delete" ForeColor="Black" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <br />
    <br />
    <table align="center">
        <tr>
            <td>
                <asp:Button ID="btnSendToIan" runat="server" Text="Send to Ian" OnClick="btnSendToIan_Click" />
            </td>
            <td>
                <asp:Button ID="btnSendToJenny" runat="server" Text="Send to Jenny" OnClick="btnSendToJenny_Click" />
            </td>
            <td>
                <asp:Button ID="btnFinalize" runat="server" Text="Finalize" OnClick="btnFinalize_Click" />
            </td>
        </tr>
    </table>
</asp:Content>
